from requests import get
import scrapy
from scrapyPro.items import ScrapyproItem
import pymysql
from selenium import webdriver

class SpidernameSpider(scrapy.Spider):
    name = "spiderName"
    start_urls = [
        "https://www.zhipin.com/gongsi/job/36c63bb74e4c6dbf1ndy2NS0EVI~.html"]
    def parse(self, response):
        div_list = response.xpath(
            '//*[@id="content"]/div/div[4]/div[1]/div[1]/ul/li'
        )
        # '//*[@id="content"]/div/div[4]/div[1]/div[1]/ul/li[1]/div[1]/div/a'
        for li in div_list:
            name = li.xpath('./div[1]/div/a/text()')[0].extract()
            pay = li.xpath('./div[1]/div/span/text()')[0].extract()
            boss_name = li.xpath('./div[2]/div/span/text()')[0].extract()
            tag_list1 = li.xpath('./div[1]/ul/li[1]/text()')[0].extract()
            tag_list2 = li.xpath('./div[1]/ul/li[2]/text()')[0].extract()
            tag_list = tag_list1 + ',' + tag_list2
            item = ScrapyproItem()
            item['name'] = name
            item['pay'] = pay
            item['bossName'] = boss_name
            item['tagList'] = tag_list
            yield item
         # 提交给管道

    def printLog(self):
        print("接下来开始打印的内容")

